package com.ttg.web.task;

import com.ttg.web.redis.RedissonUtils;
import com.ttg.web.service.Impl.VipBankInfoManagementServiceImpl;
import com.ttg.web.service.VipBankInfoManagementService;
import com.ttg.web.service.VipBankInfoService;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @author zhangHongYuan
 * @description
 * @date 2023/7/7 16:00
 */
@Component
@EnableScheduling
@Slf4j
public class VipJobTask {

    @Autowired
    private VipBankInfoManagementService vipBankInfoManagementService;

    @Autowired
    private VipBankInfoService vipBankInfoService;



/*
    */
/**
     * 月日均存款
     *//*

    @Scheduled(cron = "0 0 1 1 * ? ")
    @Async("taskAsyncPool")
    public void startRattingByRules2(){
        log.info("【JobTask startRattingByRules2 月日均存款】 start");
        boolean b = vipBankInfoManagementService.startVipRating2(null);
        log.info("【JobTask startRattingByRules2 月日均存款】 end=====>{}",b);
    }

    */
/**
     * 月日均存款增量
     *//*

    @Scheduled(cron = "0 0 1 1 * ? ")
    @Async("taskAsyncPool")
    public void startRattingByRules3(){
        log.info("【JobTask startRattingByRules3 月日均存款增量】 start");
        boolean b = vipBankInfoManagementService.startVipRating3(null);
        log.info("【JobTask startRattingByRules3 月日均存款增量】 end=====>{}",b);
    }
    */
/**
     * 连续存款
     *//*

    @Scheduled(cron = "0 0 1 1 * ? ")
    @Async("taskAsyncPool")
    public void startRattingByRules4(){
        log.info("【JobTask startRattingByRules4 连续存款】 start");
        boolean b = vipBankInfoManagementService.startVipRating4(null);
        log.info("【JobTask startRattingByRules4 连续存款】 end=====>{}",b);
    }

    */
/**
     * 贷款 咱先不做
     *//*

    //    @Scheduled(cron = "0 0 1 * * ? ")
//    @Async("taskAsyncPool")
    public void startRattingByRules5(){
        log.info("【JobTask startRattingByRules5 贷款】 start");
        boolean b = vipBankInfoManagementService.startVipRating5(null);
        log.info("【JobTask startRattingByRules5 贷款】 end=====>{}",b);
    }

    */
/**
     * 收单金额
     *//*

    @Scheduled(cron = "0 0 1 * * ? ")
    @Async("taskAsyncPool")
    public void startRattingByRules6(){
        log.info("【JobTask startRattingByRules6 收单金额】 start");
        boolean b = vipBankInfoManagementService.startVipRating6(null);
        log.info("【JobTask startRattingByRules6 收单金额】 end=====>{}",b);
    }

    */
/**
     * 收单笔数
     *//*

    @Scheduled(cron = "0 0 1 * * ? ")
    @Async("taskAsyncPool")
    public void startRattingByRules7(){
        log.info("【JobTask startRattingByRules7 收单笔数】 start");
        boolean b = vipBankInfoManagementService.startVipRating7(null);
        log.info("【JobTask startRattingByRules7 收单笔数】 end=====>{}",b);
    }

    */
/**
     * 获取银行信息 暂无银行接口
     *//*

    //    @Scheduled(cron = "0 0 1 * * ? ")
//    @Async("taskAsyncPool")
    public void getBankInfo(){
        log.info("【JobTask getBankInfo 获取银行信息】 start");
        vipBankInfoService.getBankInfo(null);
        log.info("【JobTask getBankInfo 获取银行信息】 end");
    }
*/


    /**
     * 更新等级和有效期
     */
    @Scheduled(cron = "0 0 1 * * ? ")
//    @Async("taskAsyncPool")
    public void editVipRating(){
        log.info("【JobTask editVipRating 更新等级和有效期】 start");
        boolean b = vipBankInfoManagementService.editVipRating();
        log.info("【JobTask editVipRating 更新等级和有效期】 end=====>{}",b);
    }

//
//    /**
//     * 通过excel获取银行个人信息数据
//     */
//    @Scheduled(cron = "0 0 1 * * ? ")
//    @Async("taskAsyncPool")
//    public void getPrivateBankInfoByExcel(){
//        log.info("【JobTask getBankInfo 】获取银行个人信息数据 start");
//        vipBankInfoService.getBankInfoByExcelByPrivate();
//        log.info("【JobTask getBankInfo 】获取银行个人信息数据 end");
//    }

    /**
     * 通过excel获取银行商户信息数据
     */
//    @Scheduled(cron = "0 0 1 * * ? ")
//    @Async("taskAsyncPool")
//    public void getPublicBankInfoByExcel(){
//        log.info("【JobTask getPublicBankInfoByExcel 】获取银行商户信息数据 start");
//        vipBankInfoService.getBankInfoByExcelByPublic();
//        log.info("【JobTask getPublicBankInfoByExcel 】获取银行商户信息数据 end");
//    }


    /**
     * 根据客户金融值更新成长值和积分
     */
    @Scheduled(cron = "0 0 1 * * ? ")
//    @Async("taskAsyncPool")
    public void startVipRatingAUM(){
        log.info("【JobTask editVipRating 根据客户金融值更新成长值和积分】 start");
        vipBankInfoManagementService.startVipRatingAUM();
        log.info("【JobTask editVipRating 根据客户金融值更新成长值和积分】 end");
    }

    /**
     *获取会员相关信息(关联商户)
     */
    @Scheduled(cron = "0 0 1 * * ? ")
//    @Async("taskAsyncPool")
    public void getVipInfoList(){
        log.info("【JobTask getVipInfoList 获取会员相关信息(关联商户) start");
        vipBankInfoManagementService.startVipRatingAUM();
        log.info("【JobTask getVipInfoList 获取会员相关信息(关联商户) end");
    }
}
